package com.leankit.kanban.api.client.library.transferobjects;

import java.util.ArrayList;
import java.util.List;

public class Lane {
    private Integer cardLimit;

    private Long Id;
    private int Index;
    private boolean Active;
    private String Title;
    private String Description;
    private LaneClassType ClassType;
    private LaneType Type;
    private Long ActivityId;
    private String ActivityName;
    private short Width;
    private long ParentLaneId;
    private List<CardView> Cards;
    private Orientation Orientation;
    private List<Long> ChildLaneIds;
    private List<Long> SiblingLaneIds;

    public String getLaneState() {
            if(ChildLaneIds == null)
            {
                ChildLaneIds = new ArrayList<Long>();
            }
            if (ChildLaneIds.size() > 0 && ParentLaneId == 0)
                return "parent";
            if (ChildLaneIds.size() > 0 && ParentLaneId != 0)
                return "childParent";
            if (ChildLaneIds.size() == 0 && ParentLaneId == 0)
                return "lane";
            if (ChildLaneIds.size() == 0 && ParentLaneId != 0)
                return "child";
            return "lane";
    }

    //TODO: fix
    //public void UpdateCard(CardView cardToUpdate)
    //{
    //    int index = this.Cards.IndexOf(this.Cards.FirstOrDefault(x => x.Id == cardToUpdate.Id));
    //    this.Cards.RemoveAt(index);
    //    this.Cards.Insert(index, cardToUpdate);
    //}

}
